<template>
  <div>
    <router-view></router-view>
    <van-tabbar v-model="active" active-color="#ee0a24" inactive-color="#000" @change="onChange" route>
      <van-tabbar-item icon="home-o" to="/first">首页</van-tabbar-item>
      <van-tabbar-item icon="shopping-cart-o" :badge="cartNum" to="/user/cart">洗衣篮</van-tabbar-item>
      <van-tabbar-item icon="todo-list-o"  to="/user/orderlies">订单</van-tabbar-item>
      <van-tabbar-item icon="friends-o" dot to="/user/personal">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
  import { Notify } from 'vant';
export default {
  data() {
    return {
      active: 0,
    };
  },

  created:function(){
    var now=new Date().getTime();
    var out=localStorage.getItem("tokenOut");
    if(now>out){
      localStorage.removeItem("token");
      localStorage.removeItem("userName");
    }
  },

  computed:{
    cartNum(){
      return localStorage.getItem("cartNum");
    },
  },
  methods:{
    onChange(index) {
      Notify({ type: 'primary', message: '切换',duration: 300,});
    },
    
  }
};
</script>

